package com.mycompany.myapp.service.impl;

import com.mycompany.myapp.service.ShuService;
import com.mycompany.myapp.domain.Shu;
import com.mycompany.myapp.repository.ShuRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Service Implementation for managing Shu.
 */
@Service
@Transactional
public class ShuServiceImpl implements ShuService {

    private final Logger log = LoggerFactory.getLogger(ShuServiceImpl.class);

    private final ShuRepository shuRepository;

    public ShuServiceImpl(ShuRepository shuRepository) {
        this.shuRepository = shuRepository;
    }

    /**
     * Save a shu.
     *
     * @param shu the entity to save
     * @return the persisted entity
     */
    @Override
    public Shu save(Shu shu) {
        log.debug("Request to save Shu : {}", shu);
        return shuRepository.save(shu);
    }

    /**
     * Get all the shus.
     *
     * @param pageable the pagination information
     * @return the list of entities
     */
    @Override
    @Transactional(readOnly = true)
    public Page<Shu> findAll(Pageable pageable) {
        log.debug("Request to get all Shus");
        return shuRepository.findAll(pageable);
    }

    /**
     * Get one shu by id.
     *
     * @param id the id of the entity
     * @return the entity
     */
    @Override
    @Transactional(readOnly = true)
    public Shu findOne(Long id) {
        log.debug("Request to get Shu : {}", id);
        return shuRepository.findOne(id);
    }

    /**
     * Delete the shu by id.
     *
     * @param id the id of the entity
     */
    @Override
    public void delete(Long id) {
        log.debug("Request to delete Shu : {}", id);
        shuRepository.delete(id);
    }
}
